package cn.yunhe.service;


import cn.yunhe.dao.ILoginDao;
import cn.yunhe.entity.User;
import cn.yunhe.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.HashMap;
import java.util.Map;

public class LoginService {
    SqlSession session=null;
    ILoginDao iLoginDao=null;

    /**
     * 登陆
     * @param username
     * @param password
     * @return
     */
    public User login(String username,String password){
        User user=new User();
        user.setAccount(username);
        user.setPassword(password);
        try {
            session= SqlSessionFactoryUtil.getSqlSession();
            iLoginDao=session.getMapper(ILoginDao.class);

        }finally {
            session.close();
        }

        return iLoginDao.login(user);
    }
}
